package group.rober.jeki.admin.controller

import group.rober.auth.entity.User
import group.rober.auth.service.AuthService
import group.rober.jeki.entity.Domain
import group.rober.jeki.service.DomainService
import group.rober.saber.jdbc.accessor.DataAccessor
import group.rober.saber.kit.NumberKit
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Controller
import org.springframework.web.bind.annotation.ModelAttribute
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RequestMethod
import org.springframework.web.servlet.ModelAndView

@Controller
@RequestMapping("/admin")
class AdminController {
    @Autowired
    AuthService authService;
    @Autowired
    DomainService domainService;



    @RequestMapping("/home")
    ModelAndView home() {
        return new ModelAndView("views/admin/home");
    }
    @RequestMapping("/profile")
    ModelAndView profile() {
        Map<String,Object> vars = new HashMap<String,Object>();
        return new ModelAndView("views/admin/profile",vars);
    }
    @RequestMapping("/user-list")
    ModelAndView userList() {
        List<User> userList = authService.selectUserList("",[:]);
        Map<String,Object> vars = new HashMap<String,Object>();
        return new ModelAndView("views/admin/user-list",[
                "userList":userList,
        ]);
    }

}
